<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>属性网格之自定义列 - jQuery EasyUI 演示</title>
	<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../demo.css">
	<script type="text/javascript" src="../../jquery.min.js"></script>
	<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../../locale/easyui-lang-zh_CN.js"></script>
</head>
<body>
	<h2 title="Customize Columns of PropertyGrid">属性网格之自定义列</h2>
	<p title="The columns of PropertyGrid can be changed.">　　属性网格的列可进行一定的修改（注：【项名称】列后缀全角冒号且右对齐；【属性值】列绑定编辑验证控件且其『信用评级』行额外处理了组合框的数据源和值文显示）。</p>
	<div style="margin:20px 0;"></div>
	<table class="easyui-propertygrid" style="width:300px" data-options="
				url: 'propertygrid_data1.json',
				method: 'get',
				showGroup: true,
				scrollbarSize: 0,
				columns: myCols
			">
	</table>
	<script>
		var myCols=[[
            {field:'name',title:'项名称',halign:'center', align:'right', width:100, formatter:function(v,r,i){return v+"：";}},
            {field:'value',title:'属性值',halign:'center', width:240, formatter:fmtColV}
        ]];
        var myCG=$.getJSON("CG.json");
		function fmtColV(value,rowData,rowIndex){
			switch(rowData.name){
				case '信用评级':
					var cD=myCG.responseJSON;
					for(var o in cD){if(value==cD[o].value){return cD[o].text;}}
				default:return value;
			}
		}
	</script>
</body>
</html>